package com.gitee.wsl.common.ui.symbol

import androidx.compose.ui.graphics.Path
import com.gitee.wsl.common.ui.base.Point
import kotlin.math.sqrt

fun Symbol.diamond(position: Point, radius: Float) = Diamond(position,radius)

class Diamond (override var position: Point, val radius: Float):LocationSymbol

private val tan30 = sqrt(1 / 3.0f)
private val tan30_2 = tan30 * 2

fun Path.diamond(diamond: Diamond){
    val x = diamond.radius * tan30
    with(diamond) {
        moveTo(position.x, position.y - radius)
        lineTo(position.x + x, position.y)
        lineTo(position.x, position.y + radius)
        lineTo(position.x - x, position.y)
        close()
    }
}